package Message;

import Core.MessageBuilder;
import Core.StringUtil;
import Core.IMessageHandler;
import Core.SlaveInfo;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Mr Bao
 */
public class GetSlaveResultMessageHandler implements IMessageHandler {

    public Object Process(String message) {
        int index = message.indexOf(MessageBuilder.ONE);
        String tmp = message.substring(index + 1);
        String[] content = StringUtil.Split(tmp, MessageBuilder.TWO.charAt(0));
        int id = Integer.parseInt(content[0]);
        String address = content[1];
        int port = Integer.parseInt(content[2].trim());
        SlaveInfo info = new SlaveInfo(id, address, port);
        return info;
    }
}
